package com.education.mapper;

import com.education.domain.Tbteacher;
import com.education.domain.TbteacherExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbteacherMapper {
    @SelectProvider(type=TbteacherSqlProvider.class, method="countByExample")
    int countByExample(TbteacherExample example);

    @DeleteProvider(type=TbteacherSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbteacherExample example);

    @Delete({
        "delete from tbteacher",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbteacher (strTeacherName, strTeacherMobile, ",
        "nSex, dtBirthday, lRoleId)",
        "values (#{strteachername,jdbcType=VARCHAR}, #{strteachermobile,jdbcType=VARCHAR}, ",
        "#{nsex,jdbcType=INTEGER}, #{dtbirthday,jdbcType=DATE}, #{lroleid,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbteacher record);

    @InsertProvider(type=TbteacherSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbteacher record);

    @SelectProvider(type=TbteacherSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="strTeacherName", property="strteachername", jdbcType=JdbcType.VARCHAR),
        @Result(column="strTeacherMobile", property="strteachermobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="nSex", property="nsex", jdbcType=JdbcType.INTEGER),
        @Result(column="dtBirthday", property="dtbirthday", jdbcType=JdbcType.DATE),
        @Result(column="lRoleId", property="lroleid", jdbcType=JdbcType.INTEGER)
    })
    List<Tbteacher> selectByExample(TbteacherExample example);

    @Select({
        "select",
        "lId, strTeacherName, strTeacherMobile, nSex, dtBirthday, lRoleId",
        "from tbteacher",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="strTeacherName", property="strteachername", jdbcType=JdbcType.VARCHAR),
        @Result(column="strTeacherMobile", property="strteachermobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="nSex", property="nsex", jdbcType=JdbcType.INTEGER),
        @Result(column="dtBirthday", property="dtbirthday", jdbcType=JdbcType.DATE),
        @Result(column="lRoleId", property="lroleid", jdbcType=JdbcType.INTEGER)
    })
    Tbteacher selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbteacherSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbteacher record, @Param("example") TbteacherExample example);

    @UpdateProvider(type=TbteacherSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbteacher record, @Param("example") TbteacherExample example);

    @UpdateProvider(type=TbteacherSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbteacher record);

    @Update({
        "update tbteacher",
        "set strTeacherName = #{strteachername,jdbcType=VARCHAR},",
          "strTeacherMobile = #{strteachermobile,jdbcType=VARCHAR},",
          "nSex = #{nsex,jdbcType=INTEGER},",
          "dtBirthday = #{dtbirthday,jdbcType=DATE},",
          "lRoleId = #{lroleid,jdbcType=INTEGER}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbteacher record);
}